package bbb.sss;

public class Utils {

	public static String printHeader() {
		StringBuffer sb = new StringBuffer();
		sb.append("        ");
		for (int i = 1; i <= 33; i++) {
			sb.append(String.format("%5d", i));
		}
		return sb.toString();
	}

	public static String format(String pattern, Integer number) {
		return String.format(pattern, number == null ? 0 : number);
	}

	public static int randomNumber(int max) {
		return randomNumber(max, 0);
	}

	public static int randomNumber(int max, int min) {
		int number = (int) (Math.random() * (max - min)) + 1 + min;
		return number;
	}

	public static Long c(Long A, Long B) {
		if (A >= B) {
			return p(A, B) / p(B, B);
		}
		return null;
	}

	public static Long p(Long A, Long count) {
		if (A >= count) {
			long ret = A;
			int c = 1;
			while (c < count) {
				ret *= A - c;
				c++;
			}
			return ret;
		}
		return null;
	}
	
	public static Long c(Integer A, Integer B) {
		if (A >= B) {
			return p(A, B) / p(B, B);
		}
		return null;
	}

	public static Long p(Integer A, Integer count) {
		if (A >= count) {
			long ret = A;
			int c = 1;
			while (c < count) {
				ret *= A - c;
				c++;
			}
			return ret;
		}
		return null;
	}
	
	public static void main(String[] args) {
		for (int i = 0; i < 100; i++) {
			System.out.println(randomNumber(10));
		}

	}
}
